package ${basePackageUrl}.domain;

import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import ${basePackageUrl}.domain.base.BaseVo;
import org.hibernate.annotations.Formula;

@Data
@Entity
@Table(name="${tableName}")
public class ${entityName} extends BaseVo implements Serializable {

    private static final long serialVersionUID = 1L;
<#if columns??>
<#--循环生成变量-->

<#list columns as col>
    @ApiModelProperty("${col["description"]}")
<#if col["entityColumnNo"] == "id">
    @Id
<#elseif col["entityColumnNo"] == "appId">
    @Formula("(select s.name from sys_app s where s.id = app_id )")
    private String appName;

    @Column(name = "${col["columnName"]}")
<#elseif col["entityColumnNo"] == "company">
    @Formula("(select s.name from sys_company s where s.id = company )")
    private String companyName;

    @Column(name = "${col["columnName"]}")
<#else>
    @Column(name = "${col["columnName"]}")
</#if>
    private ${col["columnType"]} ${col["entityColumnNo"]};

</#list>

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
    <#list columns as col>
        sb.append(", ${col["entityColumnNo"]}=").append(${col["entityColumnNo"]});
    </#list>
        sb.append("]");
        return sb.toString();
    }

</#if>
}